package com.js.rtu.config;

import java.util.ArrayList;
import java.util.List;

/**
 * 表九:  报警历史查询类型
 * Created by wz on 2020/7/7.
 */
public class AlarmTypeConfig {
    private static final String MODEL_0000 = "0000";
    private static final String MODEL_0001 = "0001";
    private static final String MODEL_0010 = "0010";
    private static final String MODEL_0011 = "0011";

    public static final String STR_MODEL_0000 = "无查询条件";
    public static final String STR_MODEL_0001 = "根据起止时间查询";
    private static final String STR_MODEL_0010 = "查询连接错误记录";
    private static final String STR_MODEL_0011 = "查询连接记录且需要根据起止时间查询";


    private static final String TYPE_0000 = "0000";
    private static final String TYPE_0001 = "0001";
    private static final String TYPE_0010 = "0010";
    private static final String TYPE_0011 = "0011";
    private static final String TYPE_0100 = "0100";
    private static final String TYPE_0101 = "0101";
    private static final String TYPE_0110 = "0110";
    private static final String TYPE_0111 = "0111";
    private static final String TYPE_1000 = "1000";
    private static final String TYPE_1001 = "1001";
    private static final String TYPE_1010 = "1010";
    private static final String TYPE_1011 = "1011";
    private static final String TYPE_1100 = "1100";
    private static final String TYPE_1101 = "1101";
    private static final String TYPE_1110 = "1110";


    public static final String STR_0000 = "所有类型";
    private static final String STR_0001 = "AI 下下限";
    private static final String STR_0010 = "AI 下限";
    private static final String STR_0011 = "AI 正常";
    private static final String STR_0100 = "AI上限";
    private static final String STR_0101 = "AI上上限";
    private static final String STR_0110 = "AI 下下限恢复";
    private static final String STR_0111 = "AI 下限恢复";
    private static final String STR_1000 = "AI 恢复正常";
    private static final String STR_1001 = "AI上限恢复";
    private static final String STR_1010 = "AI上上限恢复";
    private static final String STR_1011 = "DI开报";
    private static final String STR_1100 = "DI关报";
    private static final String STR_1101 = "DI变化报";
    private static final String STR_1110 = "低电量报警";
    /**
     * 报警类型
     *
     * @return 使能状态集合
     */
    public static List<String> getModelList() {
        List<String> list = new ArrayList<>();
        list.add(STR_MODEL_0000);
        list.add(STR_MODEL_0001);
        list.add(STR_MODEL_0010);
        list.add(STR_MODEL_0011);
        return list;
    }

    /**
     * 查询条件
     * @param HHHH 前四位(HHHH
     * @return 说明
     */
    public static String getStrModel(String HHHH) {
        String model;
        switch (HHHH) {
            case MODEL_0000:
                //无查询条件
                model = STR_MODEL_0000;
                break;
            case MODEL_0001:
                //需要根据起止时间查询
                model = STR_MODEL_0001;
                break;
            case MODEL_0010:
                //查询连接错误记录
                model = STR_MODEL_0010;
                break;
            case MODEL_0011:
                //查询连接记录且需要根据起止时间查询
                model = STR_MODEL_0011;
                break;
            default:
                model = "未定义";
                break;
        }
        return model;
    }

    /**
     * 查询条件
     * @param str 说明
     * @return  前四位(HHHH)
     */
    public static String getHHHH(String str) {
        String model;
        switch (str) {
            case STR_MODEL_0000 :
                //无查询条件
                model = MODEL_0000;
                break;
            case STR_MODEL_0001:
                //需要根据起止时间查询
                model = MODEL_0001 ;
                break;
            case STR_MODEL_0010:
                //查询连接错误记录
                model =MODEL_0010 ;
                break;
            case STR_MODEL_0011 :
                //查询连接记录且需要根据起止时间查询
                model = MODEL_0011;
                break;
            default:
                model = "0000";
                break;
        }
        return model;
    }



    /**
     * 报警类型
     *
     * @return 使能状态集合
     */
    public static List<String> getTypeList() {
        List<String> list = new ArrayList<>();
        list.add(STR_0000);
        list.add(STR_0001);
        list.add(STR_0010);
        list.add(STR_0011);
        list.add(STR_0100);
        list.add(STR_0101);
        list.add(STR_0110);
        list.add(STR_0111);
        list.add(STR_1000);
        list.add(STR_1001);
        list.add(STR_1010);
        list.add(STR_1011);
        list.add(STR_1100);
        list.add(STR_1101);
        list.add(STR_1110);
        return list;
    }


    /**
     * 低四位-->报警描述
     *
     * @param type 低四位(LLLL)
     * @return 报警描述
     */
    public static String getDes(String type) {
        String des;
        switch (type) {
            case TYPE_0000:
                des = STR_0000;
                break;
            case TYPE_0001:
                des = STR_0001;
                break;
            case TYPE_0010:
                des = STR_0010;
                break;
            case TYPE_0011:
                des = STR_0011;
                break;
            case TYPE_0100:
                des = STR_0100;
                break;
            case TYPE_0101:
                des = STR_0101;
                break;
            case TYPE_0110:
                des = STR_0110;
                break;
            case TYPE_0111:
                des = STR_0111;
                break;
            case TYPE_1000:
                des = STR_1000;
                break;
            case TYPE_1001:
                des = STR_1001;
                break;
            case TYPE_1010:
                des = STR_1010;
                break;
            case TYPE_1011:
                des = STR_1011;
                break;
            case TYPE_1100:
                des = STR_1100;
                break;
            case TYPE_1101:
                des = STR_1101;
                break;
            case TYPE_1110:
                des = STR_1110;
                break;
            default:
                des = "无定义类型";
                break;
        }
        return des;

    }

    /**
     * 报警描述-->低四位
     *
     * @param des 报警描述
     * @return 低四位(LLLL)
     */
    public static String getType(String des) {
        String type;
        switch (des) {
            case STR_0000:
                type = TYPE_0000;
                break;
            case STR_0001:
                type = TYPE_0001;
                break;
            case STR_0010:
                type = TYPE_0010;
                break;
            case STR_0011:
                type = TYPE_0011;
                break;
            case STR_0100:
                type = TYPE_0100;
                break;
            case STR_0101:
                type = TYPE_0101;
                break;
            case STR_0110:
                type = TYPE_0110;
                break;
            case STR_0111:
                type = TYPE_0111;
                break;
            case STR_1000:
                type = TYPE_1000;
                break;
            case STR_1001:
                type = TYPE_1001;
                break;
            case STR_1010:
                type = TYPE_1010;
                break;
            case STR_1011:
                type = TYPE_1011;
                break;
            case STR_1100:
                type = TYPE_1100;
                break;
            case STR_1101:
                type = TYPE_1101;
                break;
            case STR_1110:
                type = TYPE_1110;
                break;
            default:
                type = TYPE_0000;
                break;
        }
        return type;

    }
}
